/*
 * @Author: yangzhixin
 * @Date: 2023-06-20 15:26:00
 * @LastEditors: yangzhixin
 * @LastEditTime: 2023-08-24 13:26:02
 * @Description: file content
 * @FilePath: /leixiaoan-live-app/src/redux/reducers/login-reducer.js
 */
const userState = {
  isLogin: false,
  // isFirstLogin: false,
  // userInfo: {
  //   token_key: '',
  //   token_value: '',
  // },
  // tabbarshow: true,
  // phone: '',
  // UnReadIMMessageCount: 0,
  // isPlayingLive: false,
  // looknewtrade: false,
  // perspective: 2, // 1 个人视角 2 店铺视角
  // staff_permission: [],
  // connectedPrintDevice: null,
};

export default function LoginReducer(state = userState, action) {
  switch (action.type) {
    case 'SET_LOGIN': // 是否登录
      return {...state, isLogin: action.isLogin};
    // case 'SET_FIRST_LOGIN': // 首次登录
    //   return {...state, isFirstLogin: action.isFirstLogin};
    // case 'SET_USERINFO': // 用户信息
    //   return {...state, userInfo: action.userInfo};
    // case 'SET_TABBARSHOW':
    //   return {...state, tabbarshow: action.tabbarshow};
    // case 'SET_LOGIN_OUT': // 退出登录 清空数据
    //   return {
    //     ...state,
    //     isLogin: NO_LOGIN,
    //     userInfo: {token_key: '', token_value: ''},
    //   };
    // case 'SET_PHONE': // 是否登录
    //   return {...state, phone: action.phone};
    // case 'UnReadIMMessageCountUpdate':
    //   return {...state, UnReadIMMessageCount: action.UnReadIMMessageCount};
    // case 'UpdateIsPlayingLive':
    //   return {...state, isPlayingLive: action.isPlayingLive};
    // case 'UpdateLookNewTrade':
    //   return {...state, looknewtrade: action.looknewtrade};
    // case 'UnReadCommunity':
    //   return {...state, unReadCommunity: action.unReadCommunity};
    // case 'UpdateUnReadCommunity':
    //   return {...state, UpdateUnReadCommunity: action.UpdateUnReadCommunity};
    // case 'CHANGE_PERSPECTIVE': // erp视角切换
    //   return {...state, perspective: action.perspective};
    // case 'SET_PRINT_DEVICE':
    //   return {...state, connectedPrintDevice: action.connectedPrintDevice};
    default:
      return state;
  }
}
